#include<bits/stdc++.h>
using namespace std;
int n,a[5][100005],ma;
void f(int x,int y,int ans)
{
	ans+=a[x][y];
	if(y==n){ma=max(ma,ans);return;}
	y++;
	for(int i=1;i<=3;i++)
	{
		if(i==x)continue;
		f(i,y,ans);
	}
}
int main(){
	freopen("summer.in","r",stdin);
	freopen("summer.out","w",stdout); 
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[1][i]>>a[2][i]>>a[3][i];
	}
	f(1,1,0);
	f(2,1,0);
	f(3,1,0);
	cout<<ma;
	
	return 0;
}
